const fs = require('fs')

function saveFile(data) {

    return new Promise((resolve, reject) => {
        fs.appendFile('./email.txt',JSON.stringify(data)+'\n',(err, res) => {
            if(err) reject({msg: 'save file error!'})
            else resolve({msg: 'ok'})
        })

    })
}

module.exports = saveFile